module.exports = () => {
    return async(ctx, next) => {
        try {
            await next();
        } catch (e) {
            ctx.logger.info("Api catched error", e);
            ctx.body = {
                code: e.code || -1,
                message: e.message || '未知错误',
                data: e.data
            };
        }
    }
}